package com.alison.tomcatejdbc;

import com.alison.common.YamlMapSourceFactory;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

/**
 * @Author alison
 * @Date 2024/3/27 20:35
 * @Version 1.0
 * @Description
 */


@Configuration
@PropertySource(name = "tomcatds", value = "classpath:application-tomcat-datasource.yml", encoding = "UTF-8", factory = YamlMapSourceFactory.class)
public class DataSourceConfiguration {

    @Bean
    public JdbcTemplate jdbcTemplate(DataSource dataSource) {
        return new JdbcTemplate(dataSource);
    }


//    @Bean
//    DataSource tomcateDataSource(DataSourceProperties dataSourceProperties){
//
//    }
}
